﻿using System;
using System.Collections.Generic;
using OpenTwitter.SDK.Tencent;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using OpenTwitter.SDK;

namespace guanggun.guanggun
{
    public partial class t : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack && Session["tokenKey"]!=null)
            {
                string verifier = Request.QueryString["oauth_verifier"].ToString();//验证马
                string token = Request.QueryString["oauth_token"].ToString();
                AuthorizedUser user;
                OAuth oauth = new OAuth(Session["appkey"].ToString(), Session["appsecret"].ToString());
                oauth.Token = Session["tokenKey"].ToString();
                oauth.TokenSecret = Session["tokenSecret"].ToString();
                if (oauth.GetAccessToken(verifier, out user))
                {
                  
                    Context.Session["accessKey"] = oauth.Token;
                    Context.Session["accessSecret"] = oauth.TokenSecret;
                    Context.Session["comfirm"] = "1";//认证成功
                    Session["oauth"] = oauth;
                    Session["type"] = "tencent";
                    Response.Redirect("cs.aspx");
                }
            }
        }
    }
}